Skip to content

@W-21332566 - Use getConnection instead of axios#398

Merged
iowillhoit merged 7 commits intomainfrom
ashreya/remove-axios
Mar 5, 2026
Merged

@W-21332566 - Use getConnection instead of axios#398
iowillhoit merged 7 commits intomainfrom
ashreya/remove-axios

Conversation

@ad-shreya
Copy link
Contributor

What does this PR do?

Uses getOrgService instead of axios.
Benefits of using getOrgService-

  • getOrgService().getConnection(username) uses the Salesforce CLI’s stored auth (e.g. from sf login). You don’t manage access or refresh tokens yourself.
  • getConnection() only returns a connection for orgs that are in the MCP allowlist (allowedOrgs). Unlisted orgs are rejected with a clear error.
  • All tools use the same pattern: getOrgService().getConnection(usernameOrAlias) then call connection.

What issues does this PR fix or reference?

@W-21332566@

@ad-shreya ad-shreya changed the title @W-21332566 - Use connection instead of axios @W-21332566 - Use getConnection instead of axios Feb 23, 2026
@ad-shreya ad-shreya marked this pull request as ready for review February 23, 2026 16:05
@ad-shreya ad-shreya requested a review from a team as a code owner February 23, 2026 16:05
@iowillhoit
Copy link
Collaborator

Is this still used?

if (gitFolder === deployFolder && gitFile === deployFile) {

I am seeing some old connection logic

@ad-shreya ad-shreya force-pushed the ashreya/remove-axios branch from efd009d to 047fb88 Compare March 2, 2026 14:48
@iowillhoit
Copy link
Collaborator

Looks like axios is still in your package.json can you remove it and rebuild your yarn.lock?

@iowillhoit
Copy link
Collaborator

I am still seeing a few places that are using import { getConnection } from "./shared/auth.js" instead of getting the connection off of the services. Is there a reason for these?


try {
const result = await promoteWorkItems(input.usernameOrAlias, { workitems: prepared });
const connection = await this.services.getOrgService().getConnection(input.usernameOrAlias);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grabbing the connection twice in the same exec. You could define the top getConnection our of the try and then reuse it here

workItemName: string
): Promise<WorkItem | null | any> {
try {
const connection = await getConnection(username);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that this getConnection is removed, this function looks the same as fetchWorkItemByName below

@iowillhoit
Copy link
Collaborator

It looks like the src/commitWorkItem.ts file (non "lite" version) is only being used in a tests. Can it be removed?

@iowillhoit iowillhoit merged commit 8894550 into main Mar 5, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants